
/***************************************************
 * 函数声明
 **************************************************/
int serial_putc( char c, struct __file * );
void printf_begin(void);

void setup()
{
  Serial.begin(115200);//设置串口波特率为9600
  printf_begin();
}

int ad = 0;
void loop()
{
    ad = analogRead(A0);
    printf("%d\r\n",ad);
    delay(1);
}


/********************************************************************/
int serial_putc( char c, struct __file * )
{
  Serial.write( c );
  return c;
}
void printf_begin(void)
{
  fdevopen( &serial_putc, 0 );
}




